package day12.KeJian;

import java.io.*;

public class Tset14 {
    public static void main(String[] args) throws IOException {
        //字节缓冲输出流：BufferedOutputStream(OutputStream out)
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D://itheima//nb.txt"));
        //写数据
        bos.write("nihao\r\n".getBytes());
        bos.write("mingtian\r\n".getBytes());
        //释放资源
        bos.close();
        //字节缓冲输入流：BufferedInputStream(InputStream in)
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D://itheima//nb.txt"));
        //一次读取一个字节数组数据
        byte[] bys = new byte[1024];
        int len;
        while ((len=bis.read(bys))!= -1){
            System.out.println(new String(bys,0,len));
        }
        //释放资源
        bis.close();
    }
}
